/*
* Copyright (C) 2012-2013, <Aeihu.z, aeihu.z@gmail.com>.
*
* Game Scenario Maker is a free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* Version 2(GPLv2) as published by the Free Software Foundation.
*/

//#include "CMapEventControl.h"
//
//CMapEventControl    CMapEventControl::MapEventControl;
//
//CMapEventControl::CMapEventControl()
//{
//}
//
//bool CMapEventControl::OnEvent(string name)
//{
//    if(MapEventList.count(name) < 1)
//    {
//        cout << "CMapEventControl: can't find map event \"" << name << "\"." <<endl;
//        return false;
//    }
//
//    CParser::parser.InsertCmdList(MapEventList[name]);
//    return true;
//}
//
//void CMapEventControl::OnLoop()
//{
//    //map<string, pair<int,int>>::iterator it;
//    //for ( it=EventPoint.begin() ; it !=EventPoint.end(); it++ )
//    for (int i = 0; i < EventPoint.size(); i++ )
//    {
//        if (EventPoint[i].second.first < 0)
//        {
//            if(EventPoint[i].second.second == (int)(*TargetY))
//            {
//                OnEvent(EventPoint[i].first);
//                return;
//            }
//        }
//        else if (EventPoint[i].second.second < 0)
//        {
//            if(EventPoint[i].second.first == (int)(*TargetX))
//            {
//                OnEvent(EventPoint[i].first);
//                return;
//            }
//        }
//        else
//        {
//            if(EventPoint[i].second.first == (int)(*TargetX) && EventPoint[i].second.second == (int)(*TargetY))
//            {
//                OnEvent(EventPoint[i].first);
//                return;
//            }
//        }
//    }
//}
//
//void CMapEventControl::OnCleanup()
//{
//    EventPoint.clear();
//    
//    map<string, vector<string>>::iterator it;
//
//    for ( it=MapEventList.begin() ; it !=MapEventList.end(); it++ )
//    {
//        (*it).second.clear();
//    }
//
//    MapEventList.clear();
//
//    TargetX = TargetY = NULL;
//}
//
//void CMapEventControl::SetTarget(float* X, float* Y)
//{
//    TargetX = X;
//    TargetY = Y;
//}